Skip to content

Remove old change_linear_weights_to_* APIs #2721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Aug 13, 2025
Merged

Conversation

andrewor14
Copy link
Contributor

@andrewor14 andrewor14 commented Aug 8, 2025

Stack from ghstack (oldest at bottom):

Summary: This commit removes these super old quantization
APIs that aren't even accessible by the user:

change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors

BC-breaking notes:

Before:

change_linear_weights_to_int8_dqtensors(model)
change_linear_weights_to_int8_woqtensors(model)
change_linear_weights_to_int4_woqtensors(model)

After:

quantize_(model, Int8WeightOnlyConfig())
quantize_(model, Int4WeightOnlyConfig())

Test Plan: CI

**Summary:** This commit deprecates the following variables:

```
TORCH_VERSION_AT_LEAST_2_5
TORCH_VERSION_AT_LEAST_2_4
TORCH_VERSION_AT_LEAST_2_3
TORCH_VERSION_AT_LEAST_2_2
TORCH_VERSION_AFTER_2_5
TORCH_VERSION_AFTER_2_4
TORCH_VERSION_AFTER_2_3
TORCH_VERSION_AFTER_2_2
```

As of this commit, the latest released version of PyTorch is 2.8,
which means we can drop support for 2.5 and before since we only
support 3 of the latest releases.

The next commit will remove usages of all of these variables
from within torchao.

**Test Plan:**
```
python test/test_utils.py -k torch_version_deprecation
```

[ghstack-poisoned]
**Summary:** This commit deprecates the following variables:

```
TORCH_VERSION_AT_LEAST_2_5
TORCH_VERSION_AT_LEAST_2_4
TORCH_VERSION_AT_LEAST_2_3
TORCH_VERSION_AT_LEAST_2_2
TORCH_VERSION_AFTER_2_5
TORCH_VERSION_AFTER_2_4
TORCH_VERSION_AFTER_2_3
TORCH_VERSION_AFTER_2_2
```

As of this commit, the latest released version of PyTorch is 2.8,
which means we can drop support for 2.5 and before since we only
support 3 of the latest releases.

The next commit will remove usages of all of these variables
from within torchao.

**Test Plan:**
```
python test/test_utils.py -k torch_version_deprecation
```

[ghstack-poisoned]
**Summary:** We gate on the PyTorch version throughout the repo.
Recently PyTorch 2.8 was released, so the oldest PyTorch version
we need to support is 2.6. After this commit, we assume the user
is running PyTorch 2.6+, and remove all references to the following
variables, which are deprecated.

```
TORCH_VERSION_AT_LEAST_2_6
TORCH_VERSION_AT_LEAST_2_5
TORCH_VERSION_AT_LEAST_2_4
TORCH_VERSION_AT_LEAST_2_3
TORCH_VERSION_AT_LEAST_2_2
TORCH_VERSION_AFTER_2_5
TORCH_VERSION_AFTER_2_4
TORCH_VERSION_AFTER_2_3
TORCH_VERSION_AFTER_2_2
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Aug 8, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2721

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 8, 2025
andrewor14 added a commit that referenced this pull request Aug 8, 2025
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

ghstack-source-id: 97b1635
Pull Request resolved: #2721
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
andrewor14 added a commit that referenced this pull request Aug 8, 2025
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

ghstack-source-id: d370c59
Pull Request resolved: #2721
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
andrewor14 added a commit that referenced this pull request Aug 8, 2025
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

ghstack-source-id: ec7860e
Pull Request resolved: #2721
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
andrewor14 added a commit that referenced this pull request Aug 8, 2025
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

ghstack-source-id: 7819b42
Pull Request resolved: #2721
@andrewor14 andrewor14 added the topic: bc-breaking Use this tag if this PR breaks backward compatibility label Aug 8, 2025
@@ -120,9 +120,6 @@
ZeroPointDomain,
)
from .subclass import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file can be deleted as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like classes from this file is still being used in autoquant. I don't think we can delete or even deprecate yet...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, created an issue here instead: #2745. Let's do them separately because there are autoquant/benchmark dependencies

**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
andrewor14 added a commit that referenced this pull request Aug 8, 2025
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

ghstack-source-id: 745bf69
Pull Request resolved: #2721
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
@andrewor14 andrewor14 requested a review from jerryzh168 August 12, 2025 15:07
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
@jerryzh168
Copy link
Contributor

BC breaking note? we can direct them to new APIs I think

**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
**Summary:** This commit removes these super old quantization
APIs that aren't even accessible by the user:

```
change_linear_weights_to_int8_dqtensors
change_linear_weights_to_int8_woqtensors
change_linear_weights_to_int4_woqtensors
```

**Test Plan:** CI

[ghstack-poisoned]
@andrewor14 andrewor14 changed the base branch from gh/andrewor14/21/base to main August 13, 2025 14:09
@andrewor14 andrewor14 merged commit e79208c into main Aug 13, 2025
21 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: bc-breaking Use this tag if this PR breaks backward compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants